
BEGIN
	EXEC qa_drop_table FileDataElement
END 

CREATE TABLE [dbo].[FileDataElement](
	[DEID] [bigint] NOT NULL,
	[FileID] [bigint] NOT NULL,
	[Position] [bigint] NOT NULL,
	[Required] [char](1) NULL,
 CONSTRAINT [UK_FileDataElement] UNIQUE NONCLUSTERED 
(
	[DEID] ASC,
	[FileID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

ALTER TABLE [dbo].[FileDataElement]  WITH CHECK ADD  CONSTRAINT [FK_FileDataElement_DataElement] FOREIGN KEY([DEID])
REFERENCES [dbo].[DataElement] ([DEID])
GO

ALTER TABLE [dbo].[FileDataElement] CHECK CONSTRAINT [FK_FileDataElement_DataElement]
GO

ALTER TABLE [dbo].[FileDataElement]  WITH CHECK ADD  CONSTRAINT [FK_FileDataElement_FileDefinition] FOREIGN KEY([FileID])
REFERENCES [dbo].[FileDefinition] ([FileID])
GO

ALTER TABLE [dbo].[FileDataElement] CHECK CONSTRAINT [FK_FileDataElement_FileDefinition]
GO

